<!doctype html>
<html ng-app>
<head>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script>
</head>
<body>
<form ng-controller="StartUpController">
    Starting: <input ng-change="computeNeeded()" ng-model="funding.startingEstimate">
    Recommendation: {{funding.needed}}
    <button ng-click="requestFunding()">Fund my startup!</button>
    <button ng-click="reset()">Reset</button>
</form>
<script>
    function StartUpController($scope) {
        $scope.funding = { startingEstimate: 0 };
        $scope.computeNeeded = function () {
            $scope.funding.needed = $scope.funding.startingEstimate * 10;
        };

        $scope.requestFunding = function () {
            window.alert("Sorry, please get more customers first.");
        };

        $scope.reset = function () {
            $scope.funding.startingEstimate = 0;
            $scope.funding.needed = 0;
        };
    }
</script>
</body>
</html>
